// import { getLocal } from '../utils/local'
import _fetch from './request'
function getCode (data) {
  return _fetch({
    url: '/au/code',
    method: 'post',
    data
  })
}
function sendLogin (data) {
  return _fetch({
    url: '/au/login',
    method: 'post',
    data
  })
}
function getuserInfo () {
  return _fetch({
    url: '/au/info',
    method: 'get',
    needToken: true
    // headers: {
    //   authorization: `Bearer ${getLocal('token')}`
    // }
  })
}
function getEdit ({ nickname, intro, gender, avatar, position, area }) {
  return _fetch({
    url: '/au/edit',
    method: 'post',
    needToken: true,
    data: {
      nickname,
      intro,
      gender,
      avatar,
      position,
      area
    }
  })
}
function upload (file) {
  // 创建FormData
  const fd = new FormData()
  fd.append('files', file)
  return _fetch({
    url: '/upload',
    method: 'post',
    data: fd,
    needToken: true
  })
}
export { getCode, sendLogin, getuserInfo, getEdit, upload }
